import Mock from "mockjs";

//模拟接口
// Mock.mock("/user/getUserList", () => Mock.mock({
//     "list|1-10": [{
//       "id|+1": 1,
//       "name|1": Mock.Random.cname(),
//       "age|1-100": 23,
//       "sex|1": ["男", "女"]
//     }]
//   }));

const user = Mock.mock({
  "list|1-5": [{
    "id|+1": 1,
    "name|1": "@cname()", //Mock.Random.cname(),
    // "name|1": 0, //Mock.Random.cname(),
    "age|1-100": 23,
    "sex|1": ["男", "女"],
    // "birth|1": "@date(yyyy-MM-dd)",
    "birth|1": new Date(),
    "merry|1": true,
    "materialId|1-100": 1,
    "materialName|1": "@csentence(20)",
    "materialCode": 0
    // "materialCode|1": "@csentence(50)"
  }],
  "get": {
    "id|count": 0,
    "name|1": "@cname()", //Mock.Random.cname(),
    "age|1-100": 23,
    "sex|1": ["男", "女"],
    "birth|1": new Date(),
    // "birth|1": "@date(yyyy-MM-dd)",
    "merry|1": true,
    "materialId|1-1000": 1,
    "materialName|1": "@csentence(20)",
    "materialCode": 0
    // "materialCode|1": "@csentence(50)"
  }
});

const material = Mock.mock({
  "list|100": [{
    "id|+1": 1,
    "name|1": "@csentence(20)"
  }],
  randomList: () => {
    const mock = Mock.mock({
      "list|100": [{
        "id|+1": 1,
        "name|1": "@csentence(20)"
      }]
    });
    return mock.list;
  }
});

export default {
  user,
  material
};
